<?php

/**
 * @author aisyah
 * @copyright 2013
 */


$quest=null;
$id=null;
$reset=null;

if(isset($_POST['Submit'])){
    $username = $_POST['myusername'];
    echo "username";
    //$username = $username->trim();
    $q = "SELECT user_id, reset_quest as quest FROM user WHERE username='".$username."'";
    //print_r($q);
    $hasil = $class_db->select_table($q);
    
    foreach($hasil as $data){
        $id = $data['user_id'];
        $quest = $data['quest'];
    }
    
}

if(isset($_POST['Password'])){
    $answer = $_POST['answer'];
    $id = $_POST['id'];
    $quest=$_POST['quest'];
    $q = "SELECT reset_answer as reset FROM user WHERE user_id=$id";
    //print_r($q);
    $hasil = $class_db->select_table($q);
    
    foreach($hasil as $data){
        $reset = $data['reset'];
    }
    
    if(is_null($reset)){
        $reset = "jawaban anda salah!";
    }
}



